{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.c_title}</title>{/block}

{block name="pjax_container"}
{load href="__STATIC__/global/datepicker/css/datepicker.css" /}
{load href="__STATIC__/global/datepicker/js/plugins/moment.min.js" /}
{load href="__STATIC__/global/datepicker/js/datepicker.all.js" /}
<section class="content-header">
    <h1>{$Think.lang.c_title}</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <form class="form-horizontal form-commonsearch nice-validator n-default n-bootstrap" method="post" action="">
                        <div class="row">
                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                <label class="control-label col-xs-4">{$Think.lang.ordersn}</label>
                                <div class="col-xs-8">
                                    <input type="text" class="form-control search" name="ordersn" value="{:input('ordersn')}" placeholder="{$Think.lang.ordersn}">
                                </div>
                            </div>
                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                <label class="control-label col-xs-4">{$Think.lang.merchant}</label>
                                <div class="col-xs-8">
                                    <input type="text" class="form-control search" name="merchant" value="{:input('merchant')}" placeholder="{$Think.lang.merchant}">
                                </div>
                            </div>
                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                <label class="control-label col-xs-4">{$Think.lang.m_name}</label>
                                <div class="col-xs-8">
                                    <input type="text" class="form-control search" name="m_name" value="{:input('m_name')}" placeholder="{$Think.lang.m_name}">
                                </div>
                            </div>
                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                <label for="gender" class="control-label col-xs-4">{$Think.lang.status}</label>
                                <div class="col-xs-8">
                                    <select class="form-control select2 search" name="status">
                                        <option value="">选择</option>
                                        <option value="-1" {if input("status")==-1}selected{/if}>已关闭</option>
                                        <option value="1" {if input("status")==1}selected{/if}>待支付</option>
                                        <option value="2" {if input("status")==2}selected{/if}>预约拍摄</option>
                                        <option value="3" {if input("status")==3}selected{/if}>待拍摄</option>
                                        <option value="4" {if input("status")==4}selected{/if}>选片中</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group col-xs-12 col-sm-6 col-md-6 col-lg-6" style="float: left;">
                                <label class="control-label col-xs-12 col-sm-6 col-md-4 col-lg-2">{$Think.lang.create_time}</label>
                                <div class="col-xs-8 J-datepicker-range">
                                    <div class="row row-between">
                                        <div class="col-xs-6">
                                            <input type="text" class="form-control search" name="start_time" value="{:input('start_time')}" placeholder="{$Think.lang.start_time}">
                                        </div>
                                        <div class="col-xs-6">
                                            <input type="text" class="form-control search" name="end_time" value="{:input('end_time')}" placeholder="{$Think.lang.end_time}">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                <div class="col-sm-8 col-xs-offset-4">
                                    <button type="submit" class="btn btn-success" formnovalidate="">提交</button>
                                    <button type="button" class="btn btn-default" onclick="backVal();">重置</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>ID{:table_sort('id')}</th>
                            <th>{$Think.lang.agent}</th>
                            <th>{$Think.lang.ordersn}</th>
                            <th>{$Think.lang.status}</th>
                            <th>{$Think.lang.m_name}</th>
                            <th>{$Think.lang.good_title}</th>
                            <th>{$Think.lang.buynum}</th>
                            <th>{$Think.lang.price}</th>
                            <th>{$Think.lang.amount}</th>
                            <th width="124">{$Think.lang.action}</th>
                        </tr>
                        {volist name="dataList" id="vo"}
                        <tr>
                            <td><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td>{$vo.id}</td>
                            <td>{$vo->merchant->name}</td>
                            <td>{$vo.ordersn}</td>
                            <td>{$vo.status}</td>
                            <td>{$vo.m_name}<br/>{$vo.m_phone}</td>
                            <td><img src="{$vo->goods->good_img}" style="width:50px;border-radius:50%;" /><br/>{$vo->goods->good_title}</td>
                            <td>{$vo.buynum}</td>
                            <td>{$vo.price}</td>
                            <td>{$vo.amount}</td>
                            <td>
                                {:auth_action(CONTROLLER_NAME.'/detail', 'a', '订单详情', ['ordersn' => $vo.ordersn])}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$dataList->render()|raw}
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });
})
function backVal(){
    $(".search").val("");
    $("[name=status]").val("").trigger('change');
    $("[type=submit]").click();
}
</script>
<!-- datepicker -->
<script type="text/javascript">
    $(function(){
        $('.J-datepicker-range').datePicker({
            format: 'YYYY-MM-DD HH:mm',
            hasShortcut: true,
            isRange: true,
            shortcutOptions: [
            {
              name: '今天',
              day: '0,0',
              time: '00:00:00,23:59:59'
            },{
              name: '昨天',
              day: '-1,-1',
              time: '00:00:00,23:59:59'
            },{
              name: '最近一周',
              day: '-7,0',
              time:'00:00:00,'
            }, {
              name: '最近一个月',
              day: '-30,0',
              time: '00:00:00,'
            }]
        });
    })
</script>
{/block}